public class Demo5{
    static Object object = new Object();
    public static void main(String[] args) {
        Thread t1 = new Thread(()->{
            synchronized( object){
                    try {
                        object.wait();
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
        });
        Thread t2 = new Thread(()->{
           synchronized ( object){
               while ( true){
               }
           }
        });
        t1.start();
        t2.start();
        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println(t1.getState());
        System.out.println(t2.getState());
    }
}
